package cn.scu.ne04jdemo.entitiy;

import cn.scu.ne04jdemo.util.SysCodeUtil;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.annotations.Mapper;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@Builder
@AllArgsConstructor
@ContentRowHeight(20)
@HeadRowHeight(35)
@ColumnWidth(20)
@TableName(value = "t_retroactive_ownership")
public class RetroactiveOwnership implements Serializable {
    @TableId(type = IdType.AUTO)
    @ExcelIgnore
    private Long id;
    @ExcelIgnore
    private String rightType;
    @TableField(exist = false)
    @ExcelProperty(value = "权属名", index = 0)
    private String rightTypeName;
    @ExcelProperty(value = "当前权利人", index = 1)
    private String cUserName;
    @ExcelProperty(value = "数据集名称", index = 2)
    private String dataName;
    @ExcelIgnore
    private String txProcess;
    @TableField(exist = false)
    @ExcelProperty(value = "交易过程", index = 3)
    private String txProcessName;
    @ExcelProperty(value = "交易结束时间", index = 4)
    private String endTime;
    @ExcelProperty(value = "变更次数", index = 5)
    private String changeCount;

    @TableField(fill = FieldFill.INSERT)
    @JsonIgnore
    @ExcelIgnore
    private LocalDateTime createDate;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonIgnore
    @ExcelIgnore
    private LocalDateTime updateDate;

    public String getRightTypeName() {
        return SysCodeUtil.SysCodeMap.get(this.rightType);
    }

    public String getTxProcessName() {
        return SysCodeUtil.SysCodeMap.get(this.txProcess);
    }
}
